import { createRouter, createWebHistory } from 'vue-router'
import mainView from '@/views/mainView.vue'
import detectView from '@/views/detectView.vue'
import imageSelectView from '@/views/imageSelectView.vue'
import imageHistoryView from '@/views/imageHistoryView.vue'
import trackView from '@/views/trackView.vue'
import videoSelectView from '@/views/videoSelectView.vue'
import videoHistoryView from '@/views/videoHistoryView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/main',
      name: 'main',
      components: {
        default: mainView
      },
    },
    {
      path: '/',
      redirect: '/imageSelect',
    },
    {
      path: '/detect',
      name: 'detect',
      component: detectView,
    },
    {
      path: '/imageSelect',
      name: 'imageSelect',
      component: imageSelectView,
    },
    {
      path: '/imageHistory',
      name: 'imageHistory',
      component: imageHistoryView,
    },
    {
      path: '/track',
      name: 'track',
      component: trackView,
    },
    {
      path: '/videoSelect',
      name: 'videoSelect',
      component: videoSelectView,
    },
    {
      path: '/videoHistory',
      name: 'videoHistory',
      component: videoHistoryView,
    },
  ],
})

// router.beforeEach((to, from, next) => {
//   console.log(to, from)
//   next()
// })

export default router
